<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title>S.Hackles-后台管理系统 - 登录</title>
    <meta name="keywords" content="S.Hackles后台管理系统">
    <meta name="description" content="S.Hackles后台管理系统">
    <link href="/Public/Admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/Admin/css/animate.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/style.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/login.min.css" rel="stylesheet">
    <style>
        .layui-layer-content{
            color: black;
        }
    </style>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if(window.top!==window.self){window.top.location=window.location};
    </script>

</head>

<body class="signin">
    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-7">
                <div class="signin-info">
                    <div class="logopanel m-b">
                        <h1>>> S.Hackles <<</h1>
                    </div>
                    <div class="m-b"></div>
                    <h4>欢迎使用 <strong>后台管理系统</strong></h4>
                    <h4>&nbsp;</h4>
                    <ul class="m-b">
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>青青子衿，悠悠我心</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>纵我不往，子宁不嗣音？</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>青青子佩，悠悠我思。</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>纵我不往，子宁不来？</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>挑兮达兮，在城阙兮。</li>
                        <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i>一日不见，如三月兮。</li>
                    </ul>
                </div>
            </div>
            <div class="col-sm-5">
                <form method="post" id="from" action="<?php echo U('Login/gologin');?>">
                    <h4 class="no-margins">登录：</h4>
                    <p class="m-t-md">登录到后台管理</p>
                    <input type="text" class="form-control uname" name="username" id="username" placeholder="用户名" />
                    <input type="password" class="form-control pword m-b" name="password" id="password" placeholder="密码" />
                    <a href="#">忘记密码了？</a>
                    <button class="btn btn-primary btn-block">登录</button>
                </form>
            </div>
        </div>
        <div class="signup-footer">
            <div class="pull-left">
                &copy; 2017 All Rights Reserved. S.Hackles
            </div>
        </div>
    </div>
    <script src="/Public/Admin/js/jquery.min.js"></script>
    <script src="/Public/Admin/js/jquery.form.js"></script>
    <script src="/Public/Admin/js/plugins/layer.3/layer.js"></script>
    <script src="/Public/Admin/js/common.js"></script>
    <script>
        $(function(){
            $('#from').ajaxForm({
                beforeSubmit: checkForm,
                success: complete,
                dataType: 'JSON',
                clearForm:true
            });
            function checkForm(){
                var userStr = $('#username').val();

                if('' == userStr){
                    common.error('用户名不能为空',5000);
//                    $('button').removeClass('btn-info').addClass('btn-primary').removeAttr('disabled','disabled').text('登录');
                    return false;
                }
                if(userStr.length < 5){
                    common.error('用户名不能小于5位',5000);
                    $('#username').val('').focus();
                    $('#password').val('');
                    return false;
                }
                if(userStr.length > 15){
                    common.error('用户名不能大于15位',5000);
                    $('#username').val('').focus();
                    $('#password').val('');
                    return false;
                }
                var passStr = $('#password').val();
                if('' == passStr){
                    common.error('密码不能为空',5000);
                    return false;
                }
                if(passStr.length < 5){
                    common.error('密码不能小于5位',5000);
                    $('#password').val('').focus();
                    return false;
                }
                if(passStr.length > 15){
                    common.error('密码不能大于15位',5000);
                    $('#password').val('').focus();
                    return false;
                }
            }
            function complete(data){
                $('button').removeClass('btn-primary').addClass('btn-info').attr('disabled','disabled').text('登录中...');
                if(data.status > 0){
                    $('button').removeClass('btn-info').addClass('btn-primary').removeAttr('disabled','disabled').text('登录');
                    common.error(data.msg,5000);
                    return false;
                }
                common.success(data.msg,"<?php echo U('Index/index');?>");

            }
        });
    </script>
</body>
</html>